function changePoints(form, obj)
{
	//Get the value of the month
	var questionType = form.questionType.value;
    //alert(questionType);
    
    var text = obj[questionType - 1].text;
    var num = text.match(/\d{2}/);
	
	//Set the number of options for day
	form.points.options.length = num / 5;
	
	
	//Populate the select options
	for(x = 0; x < num / 5; x++)
	{
		form.points.options[x] = new Option(5*(x + 1), 5*(x + 1));
	} 
}



function checkForm(e)
{
	if(!supportedBrowser(e)) return true;
	submit = true;
/*
	required = getElementsByClassName("required");
	for(var i in required) {
		if(required[i].value.length == 0) {
			submit = false;
			break;
		}
	}
*/		
	if(submit)
	{
		e.submit();
		return true;
	}
	else {
		alert("Please fill the fields before continuing.");
		return false;
	}
}

onload= function () {
	document.getElementById('question_title').focus();
}

function remove(e) {
	element = getElement(e);
	num = element.attributes.getNamedItem("id");

	input = document.getElementById("source"+num);
	source = document.getElementById("source");
	
	source.removeChild(input);
	//source.removeChild(element);
}

function addContent(e) {
	if(!supportedBrowser(e)) return true;

	lineBreak = document.createElement("br");
	newInput = document.createElement("input");
	newInput.setAttribute("type", "file");

	countE = document.getElementById("sourceCount");
	count = countE.attributes.getNamedItem("value").value;
	count = parseInt(count) + 1;
	countE.setAttribute("value", count);

	newInput.setAttribute("name", "source"+count);
	newInput.setAttribute("id", "source"+count);
	
	list = document.getElementById("source");
	list.appendChild(lineBreak);
	list.appendChild(newInput);

	rm = document.createElement("a");
	rm.setAttribute("class", "link");
	rm.setAttribute("id", count);
	rm.innerHTML = "remove";
	// Can't get this dynamic thing to work
	//rm.onclick = remove;

	//list.appendChild(rm);

	return false;
}

document.getElementById("addSource").onclick = addContent;
//document.getElementById("submit").onclick = checkForm;
